--[[ 编码: WMS-09-14 名称: 锁-仓库变化后 作者:HAN 日期:2025-3-06 级别:固定 (说明本段代码在项目中不太会变化) 函数: AfterWareahouseChg 功能: 根据出库类型不同 设置显示不显示一些控件 更改记录: --]] json = require ("json") mobox = require ("OILua_JavelinExt") m3 = require("oi_base_mobox") function AfterWareahouseChg ( strLuaDEID ) local nRet, strRetInfo, n nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_WH_CODE" ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end local obj_attrs = json.decode( strRetInfo ) local wh_code = lua.Get_StrAttrValue( obj_attrs[1].value ) local strCondition = "S_WH_CODE = '"..wh_code.."'" local strOrder = "S_CODE" local area_choice_items = {} nRet, strRetInfo = mobox.queryDataObjAttr(strLuaDEID, "Area", strCondition, strOrder,"S_CODE" ) if (nRet ~= 0) then lua.Error( "获取【库区】信息失败! " .. strRetInfo) end if ( strRetInfo ~= '' ) then local area = {} success, area = pcall( json.decode, strRetInfo) if ( success == false ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取【库区】信息失败! 非法的JSON格式!"..area ) end for n = 1, #area do attrs = area[n].attrs area_choice_items[n] = attrs[1].value end end local action = { { action_type = "set_dlg_attr", value = { { attr = "S_AREA_CODE", value = "", choice_list = area_choice_items } } } } nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end end